package jourre;

import cn.hutool.db.Db;
import cn.hutool.db.Entity;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import lombok.SneakyThrows;

import java.io.File;
import java.util.List;
import java.util.Map;

/**
 * @Author: gcr
 * @Date: 2022-6-20 16:31
 */
public class AddJourIdByMan {
    @SneakyThrows
    public static void main(String[] args) {
        // 用于把姚主任的期刊信息放在泰医服务器上
        String path = "D:\\Users\\GCR\\Desktop\\2.xls";

        String table = "help_fudan_hospital_specialist_journal";
        Db use = Db.use();

        ExcelReader reader = ExcelUtil.getReader(new File(path));
        List<Map<String, Object>> maps = reader.readAll();
        for (Map<String, Object> map : maps) {
            String jourid = map.get("jourid").toString();
            String jname = map.get("jour").toString();
            Entity entity = new Entity();
            entity.setTableName(table);
            entity.set("specialist", "省立医院-内分泌科");
            entity.set("jour_id", Integer.parseInt(jourid));
            entity.set("jour_name", jname);
            entity.set("jour_name_china", jname);
            entity.set("jour_score", "1");
            entity.set("code", "1");
            int insert = use.insert(entity);
            System.out.println(insert);
        }

    }
}
